import type { ArticleDetail, ArticlesList, ChannelsList } from '@/types/home'
import { request } from '@/utils/request'

// 获取用户频道列表
export const getChannelsList = () => request<ChannelsList>('user/channels')

// 获取频道文章列表
export const getArticlesList = (channel_id: string, timestamp: string) =>
  request<ArticlesList>('articles', 'GET', {
    channel_id,
    timestamp
  })

// 获取文章详情
export const getArticledetail = (art_id: string) =>
  request<ArticleDetail>(`articles/${art_id}`)

// 关注用户
export const follow = () => request('user/followings', 'POST', { target: 1111 })

// 取消关注
export const cancelFollow = () => request('user/followings/1111', 'DELETE')
